
project(teletype)
cmake_minimum_required(VERSION 2.8)

set(THIRD_PARTY_DIR ${PROJECT_SOURCE_DIR}/third_party)

message("   >>> Build for.: ${BUILD_JUST}")
message("   >>> Build type: ${CMAKE_BUILD_TYPE}")

set(UNITTEST OFF CACHE BOOL "Compila os testes unitarios")

set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/products)
    


include_directories(${PROJECT_SOURCE_DIR}/common/proto
                    ${PROJECT_SOURCE_DIR}/common/sys
                    ${PROJECT_SOURCE_DIR}/third_party/cwebsocket)

if (${BUILD_JUST} STREQUAL "client")
    add_subdirectory(client)
elseif (${BUILD_JUST} STREQUAL "server")
    add_subdirectory(server)
endif()


if (${UNITTEST})
    set(GTEST_DIR ${PROJECT_SOURCE_DIR}/third_party/gtest-1.6.0)
    set(GTEST_INCLUDE_DIRS ${GTEST_DIR}/include)
    
    # Essas libs foram geradas na mao. Devem ser regeradas no target destino.
    set(GTEST_BOTH_LIBRARIES ${GTEST_DIR}/build/libgtest.a ${GTEST_DIR}/build/libgtest_main.a)
endif()

#add_subdirectory(third_party)


add_subdirectory(common)